home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / src-server / wc_List.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  59.7 KB  |  1,565 lines

  1. /* -*-C-*-
  2. ********************************************************************************
  3. *
  4. * File:         wc_List.c
  5. * RCS:          $Header: wc_List.c,v 1.4 91/03/14 03:14:46 mayer Exp $
  6. * Description:  XM_LIST_WIDGET_CLASS
  7. * Author:       Niels Mayer, HPLabs
  8. * Created:      Sat Oct 28 03:28:28 1989
  9. * Modified:     Thu Oct  3 23:40:23 1991 (Niels Mayer) mayer@hplnpm
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       X11r5 contrib tape release
  13. *
  14. * WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  15. * XLISP version 2.1, Copyright (c) 1989, by David Betz.
  16. *
  17. * Permission to use, copy, modify, distribute, and sell this software and its
  18. * documentation for any purpose is hereby granted without fee, provided that
  19. * the above copyright notice appear in all copies and that both that
  20. * copyright notice and this permission notice appear in supporting
  21. * documentation, and that the name of Hewlett-Packard and David Betz not be
  22. * used in advertising or publicity pertaining to distribution of the software
  23. * without specific, written prior permission.  Hewlett-Packard and David Betz
  24. * make no representations about the suitability of this software for any
  25. * purpose. It is provided "as is" without express or implied warranty.
  26. *
  27. * HEWLETT-PACKARD AND DAVID BETZ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  28. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  29. * IN NO EVENT SHALL HEWLETT-PACKARD NOR DAVID BETZ BE LIABLE FOR ANY SPECIAL,
  30. * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  31. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  32. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  33. * PERFORMANCE OF THIS SOFTWARE.
  34. *
  35. * See ./winterp/COPYRIGHT for information on contacting the authors.
  36. * Please send modifications, improvements and bugfixes to mayer@hplabs.hp.com
  37. * Post XLISP-specific questions/information to the newsgroup comp.lang.lisp.x
  38. *
  39. ********************************************************************************
  40. */
  41. static char rcs_identity[] = "@(#)$Header: wc_List.c,v 1.4 91/03/14 03:14:46 mayer Exp $";
  42.  
  43. /*
  44.  * <limits.h> defines machine dependent limits on sizes of numbers, if your
  45.  * machine doesn't have this, then your compiler doesn't conform to standards
  46.  * XPG2, XPG3, POSIX.1, FIPS 151-1 and you should complain to the manufacturer.
  47.  * 
  48.  * If for some reason your system isn't standards-conforming, you may work
  49.  * around this problem by using the following definitions (assuming 32 bit machine):
  50.  * 
  51.  * #define INT_MAX 2147483647
  52.  */
  53. #include <limits.h>
  54. #include <stdio.h>
  55. #include <Xm/Xm.h>
  56. #include <Xm/List.h>
  57. #include "winterp.h"
  58. #include "user_prefs.h"
  59. #include "xlisp/xlisp.h"
  60. #include "w_funtab.h"
  61. #include "w_XmString.h"
  62.  
  63.  
  64. extern Widget Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(); /* w_classes.c */
  65.  
  66.  
  67. /******************************************************************************/
  68. static int Get_ListPosition_Argument()
  69. {
  70.   LVAL lval_position;
  71.   long position;
  72.  
  73.   lval_position = xlgafixnum();
  74.   position = (long) getfixnum(lval_position);
  75.   if (position < 0L)
  76.     xlerror("List Position/Count argument must be a fixnum >= 0.", lval_position);
  77.   if (position > (long) INT_MAX)
  78.     xlerror("List Position/Count argument too large.", lval_position);
  79.   
  80.   return ((int) position);
  81. }
  82.  
  83. /******************************************************************************/
  84. static SuperXmStringTable Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable()
  85. {
  86.   LVAL lisp_val = xlgetarg();
  87.   return (Wxms_Cvt_LispStringSequence_to_SuperXmStringTable(lisp_val));    /* must call Wxms_Free_SuperXmStringTable() when done w/ result */
  88. }
  89.  
  90.  
  91. /******************************************************************************/
  92. static LVAL IntList_To_Lisp_Vector(intlist, size)
  93.      int* intlist;
  94.      int  size;
  95. {
  96.   LVAL result;
  97.   int i;
  98.   
  99.   if (!intlist || !size)
  100.     return (NIL);
  101.  
  102.   xlsave1(result);
  103.   result = newvector(size);
  104.   for (i = 0; i < size; i++)
  105.     setelement(result, i, cvfixnum((FIXTYPE) intlist[i]));
  106.   xlpop();
  107.   return (result);
  108. }
  109.  
  110.  
  111. /*****************************************************************************
  112.  * (send XM_LIST_WIDGET_CLASS :new
  113.  *                           [:managed/:unmanaged]
  114.  *                           [:scrolled]
  115.  *                           [<name>]
  116.  *                           <parent> 
  117.  *                           [:XMN_<arg1> <val1>]
  118.  *                           [. . .             ]
  119.  *                           [:XMN_<argN> <valN>])
  120.  *
  121.  * The optional keyword submessage :managed will cause a subsequent call
  122.  * to XtManageChild(). If the submessage :unmanaged is present, or no
  123.  * submessage, then XtManageChild() won't be called, and the resulting
  124.  * widget will be returned unmanaged.
  125.  *
  126.  *     (send XM_LIST_WIDGET_CLASS :new ...)
  127.  *     --> XmCreateList();
  128.  *     (send XM_LIST_WIDGET_CLASS :new :scrolled ...)
  129.  *     --> XmCreateScrolledList();
  130.  *          Note: extra convenience fn XmCreateScrolledList() puts the
  131.  *      list widget inside a scrolled window but returns the list widget.
  132.  ****************************************************************************/
  133. LVAL Xm_List_Widget_Class_Method_ISNEW()
  134. {
  135.   extern ArgList Wres_Get_LispArglist(); /* from w_resources.c */
  136.   extern void    Wres_Free_C_Arglist_Data(); /* from w_resources.c */
  137.   extern LVAL k_managed, k_unmanaged, k_scrolled;
  138.   LVAL self, o_parent;
  139.   char* name;
  140.   Boolean managed_p, scrolled_p;
  141.   Widget parent_widget_id, widget_id;
  142.  
  143.   self = xlgaobject();        /* NOTE: xlobj.c:clnew() returns an OBJECT; if this method
  144.                    returns successfully, it will return a WIDGETOBJ */
  145.  
  146.   /* get optional managed/unmanaged arg */
  147.   if (moreargs() && ((*xlargv == k_managed) || (*xlargv == k_unmanaged)))
  148.     managed_p = (nextarg() == k_managed);
  149.   else
  150.     managed_p = FALSE;        /* by default don't call XtManageChild() */
  151.  
  152.   /* get optional :scrolled arg */
  153.   if (moreargs() && (*xlargv == k_scrolled)) {
  154.     nextarg();
  155.     scrolled_p = TRUE;
  156.   }
  157.   else
  158.     scrolled_p = FALSE;        /* by default, we don't want a scroled list */
  159.  
  160.   /* get optional <name> arg */
  161.   if (moreargs() && (stringp(*xlargv)))
  162.     name = (char*) getstring(nextarg());
  163.   else
  164.     name = "";            /* default name */
  165.  
  166.   /* get required <parent> widget-object arg */
  167.   parent_widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&o_parent);
  168.  
  169.   /*
  170.    * Store the widget object <self> in the XmNuserData resource on the
  171.    * widget. This will allow us to retrieve the widget object from Xtoolkit
  172.    * functions returning widget ID's without having to keep around a table
  173.    * of widgetID-->widget-objects.
  174.    */
  175.   ARGLIST_RESET(); ARGLIST_ADD(XmNuserData, (XtArgVal) self); 
  176.  
  177.   if (moreargs()) {        /* if there are more arguments, */
  178.     Cardinal xt_numargs;    /* then we have some extra widget resources to set */
  179.     ArgList xt_arglist = Wres_Get_LispArglist(self, parent_widget_id, ARGLIST(), &xt_numargs);
  180.     if (scrolled_p)
  181.       widget_id = XmCreateScrolledList(parent_widget_id, name, xt_arglist, xt_numargs);
  182.     else
  183.       widget_id = XmCreateList(parent_widget_id, name, xt_arglist, xt_numargs);
  184.     Wres_Free_C_Arglist_Data();
  185.   }
  186.   else 
  187.     if (scrolled_p)
  188.       widget_id = XmCreateScrolledList(parent_widget_id, name, ARGLIST());
  189.     else
  190.       widget_id = XmCreateList(parent_widget_id, name, ARGLIST());
  191.  
  192.   Wcls_Initialize_WIDGETOBJ(self, widget_id);
  193.  
  194.   if (managed_p)
  195.     XtManageChild(widget_id);
  196.  
  197. #ifdef DEBUG_WINTERP_1
  198.   Wcls_Print_WidgetObj_Info(self);
  199. #endif
  200.   return (self);
  201. }
  202.  
  203.  
  204. #ifdef WINTERP_MOTIF_11
  205. /*****************************************************************************
  206.  * (send <listwidget> :PARENT)
  207.  *    ==> returns widgetobj
  208.  *
  209.  * This method is needed to work around a problem in Motif 1.1. It serves
  210.  * to override incorrect behavior when you call (send <listwidget> :PARENT)
  211.  * using the method defined on WIDGET_CLASS (List's super..class).
  212.  * 
  213.  * The problem was that :PARENT was returning the same widgetobj it was 
  214.  * given, but only in the case of a list/text widget created with the
  215.  * :scrolled option. Therefore, we check for this case, and if it occured
  216.  * we create a new widgetobj for the scrolled-window parent...
  217.  *
  218.  * Detailed analysis of problem: For each widgetobj created by winterp,
  219.  * we store the widgetobj on each  widgetID by doing
  220.  * XtSetValues(widgetid, XmNuserData<-->widgetobj).
  221.  * If the widget is a "hidden" child or parent of a widgetobj, then
  222.  * XmNuserData isn't set, so it defaults to NULL. When we retrieve a
  223.  * widgetID from the toolkit (as done when XtParent() is called) we then
  224.  * look at XmNuserData to lookup the associated widgetobj. If XmNuserData
  225.  * is NULL, then we create a new widgetobj of the appropriate class and
  226.  * initialize the widgetobj's widgetID...
  227.  * 
  228.  * The problem here results from the fact that XtGetValues(XmNuserData)
  229.  * on the parent widget returns the child's widgetobj. Since the
  230.  * parent widget is "hidden", we'd expect XmNuserData to be NULL.
  231.  * Instead, XmNuserData for the parent is set to the widgetobj of the
  232.  * child! This proc works around that problem...
  233.  *
  234.  * Note: see also w_libXt.c:Widget_Class_Method_PARENT(),
  235.  * wc_Text.c:Xm_Text_Widget_Class_Method_PARENT()
  236.  ****************************************************************************/
  237. LVAL Xm_List_Widget_Class_Method_PARENT()
  238. {
  239.   extern LVAL Wcls_WidgetClassID_To_WIDGETCLASSOBJ(); /* w_classes.c */
  240.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ();
  241.  
  242.   LVAL self, lval_parent;
  243.   Widget widget_id, parent_id;
  244.  
  245.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  246.   xllastarg();
  247.  
  248.   parent_id = XtParent(widget_id);
  249.   lval_parent = Wcls_WidgetID_To_WIDGETOBJ(parent_id);
  250.   
  251.   if (lval_parent != self)
  252.     return (lval_parent);
  253.   else {            /* handle motif 1.1 fuckup */
  254.     LVAL o_widgetclass;
  255.     if (o_widgetclass = Wcls_WidgetClassID_To_WIDGETCLASSOBJ(XtClass(parent_id))) /* returns NIL on failure */
  256.       /* (2): Create a new WIDGETOBJ of the appropriate class. */
  257.       lval_parent = newobject(o_widgetclass, WIDGETOBJ_SIZE);
  258.     else {            /* fail gracefully (i think). */
  259.       extern LVAL o_WIDGET_CLASS;    /* from wc_WIDGET.c */
  260.       errputstr("Warning -- In Wcls_WidgetID_To_WIDGETOBJ() couldn't find a valid\n");
  261.       errputstr("           widgetclass object inside widget classrecord. Creating\n");
  262.       errputstr("           a \"generic\" WIDGETOBJ of class WIDGET_CLASS.\n");
  263.       lval_parent = newobject(o_WIDGET_CLASS, WIDGETOBJ_SIZE);
  264.     }
  265.     Wcls_Initialize_WIDGETOBJ(lval_parent, parent_id);
  266.     
  267.     /* Store the pointer to the new widgetobj in the widget's XmNuserData resource. */
  268.     ARGLIST_RESET(); ARGLIST_ADD(XmNuserData, (XtArgVal) lval_parent);
  269.     XtSetValues(parent_id, ARGLIST());  
  270.     return (lval_parent);
  271.   }
  272. }
  273. #endif                /* WINTERP_MOTIF_11 */
  274.  
  275.  
  276. /*****************************************************************************
  277.  * (send <listwidget> :ADD_ITEM <item> <position>)
  278.  *    ==> returns the new item, as an XmString.
  279.  * This method adds <item> to <listwidget> at the given position.
  280.  * <item> is a string or XmString. If <item> is given as a string, it
  281.  *    is converted to an XmString and that XmString is returned.
  282.  * <position> is an positive fixnum. Specifying 0 will add the item to the end
  283.  *    of the list, 1 makes it the first item, 2 the second, etc.
  284.  *
  285.  * void XmListAddItem(w, item, pos)
  286.  * Widget w;
  287.  * XmString item;
  288.  * int pos;
  289.  ****************************************************************************/
  290. LVAL Xm_List_Widget_Class_Method_ADD_ITEM()
  291. {
  292.   LVAL self, lval_item;
  293.   int position;
  294.   Widget widget_id;
  295.   XmString str;
  296.  
  297.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);    /* get <listwidget> */
  298.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  299.   position = Get_ListPosition_Argument(); /* get <position> */
  300.   xllastarg();
  301.  
  302.   XmListAddItem(widget_id, str, position);
  303.  
  304.   /* note: XmListAddItem() creates a copy of the XmString <item>, allowing us to
  305.      free str whenever we want. If <item> was passed in as an XmString, the
  306.      XmString will be freed via garbage collection whenever <item> is no longer
  307.      referenced. If <item> was passed in as a normal string, then a new
  308.      XmString object is created in this method -- it will be freed when it
  309.      gets garbage collected.
  310.      */
  311.   return (lval_item);        /* return the XmString item. */
  312. }
  313.  
  314.  
  315. #ifdef WINTERP_MOTIF_11
  316. /*****************************************************************************
  317.  * (send <listwidget> :ADD_ITEMS <item-seq> <position>)
  318.  *    ==> returns <listwidget>
  319.  *
  320.  * <item-seq> is a list or array of strings or XmStrings. Note that if 
  321.  * strings are given, they will automatically be converted to XmStrings
  322.  * before being passed to <listwidget>.
  323.  *
  324.  * <position> is an positive fixnum. Specifying 0 will add the item to the end
  325.  *    of the list, 1 makes it the first item, 2 the second, etc.
  326.  * -------------------------------------------------------------------------
  327.  * void XmListAddItems (Widget w, XmString *items, int item_count, int pos);
  328.  ****************************************************************************/
  329. LVAL Xm_List_Widget_Class_Method_ADD_ITEMS()
  330. {
  331.   LVAL self;
  332.   int position;
  333.   Widget widget_id;
  334.   SuperXmStringTable superstrtab;
  335.  
  336.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  337.   superstrtab = Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable(); /* get <item-seq> */
  338.   position = Get_ListPosition_Argument(); /* get <position> */
  339.   xllastarg();
  340.  
  341.   XmListAddItems(widget_id, superstrtab->xmstrtab, superstrtab->xmstrtab_end_idx, position);
  342.  
  343.   /* note: XmListAddItems() creates a copy of the XmStrings in <item-seq>, allowing us to
  344.      free all XmStrings created. */
  345.   Wxms_Free_SuperXmStringTable(superstrtab); /* dealloc any XmStrings created by autoconversion in Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable() */
  346.  
  347.   return (self);        /* <listwidget> */
  348. }
  349. #endif                /* WINTERP_MOTIF_11 */
  350.  
  351.  
  352. /*****************************************************************************
  353.  * (send <listwidget> :ADD_ITEM_UNSELECTED <item> <position>)
  354.  *    ==> returns <item> as an XmString.
  355.  * This method adds <item> to <listwidget> at the given position and ensures
  356.  * that <item> is not selected.
  357.  * <item> is a string or XmString. If <item> is given as a string, it
  358.  *    is converted to an XmString and that XmString is returned by the method.
  359.  * <position> is an positive fixnum. Specifying 0 will add the item to the end
  360.  *    of the list, 1 makes it the first item, 2 the second, etc.
  361.  *
  362.  * void XmListAddItemUnselected(w, item, pos)
  363.  *     Widget w;
  364.  *     XmString item;
  365.  *     int         pos;
  366.  ****************************************************************************/
  367. LVAL Xm_List_Widget_Class_Method_ADD_ITEM_UNSELECTED()
  368. {
  369.   LVAL self, lval_item;
  370.   int position;
  371.   Widget widget_id;
  372.   XmString str;
  373.  
  374.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  375.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  376.   position = Get_ListPosition_Argument(); /* get <position> */
  377.   xllastarg();
  378.  
  379.   XmListAddItemUnselected(widget_id, str, position);
  380.  
  381.   /* note: XmListAddItemUnselected() creates a copy of the XmString <item>,
  382.      allowing us to free str whenever we want. If <item> was passed in as an
  383.      XmString, the XmString will be freed via garbage collection whenever <item>
  384.      is no longer referenced. If <item> was passed in as a normal string, then a
  385.      new XmString object is created in this method -- it will be freed when it
  386.      gets garbage collected.  */
  387.   return (lval_item);        /* return the XmString item. */
  388. }
  389.  
  390.  
  391. /*****************************************************************************
  392.  * (send <listwidget> :DELETE_ITEM <item>)
  393.  *    ==> returns <item> as an XmString
  394.  * This method deletes the specified <item> from <listwidget>, giving
  395.  * an XtWarning if <item> doesn't exist.
  396.  * <item> is a string or XmString. If <item> is given as a string, it
  397.  *    is converted to an XmString and that XmString is returned by the method.
  398.  *
  399.  * void XmListDeleteItem(w, item)
  400.  *     Widget w;
  401.  *     XmString item;
  402.  ****************************************************************************/
  403. LVAL Xm_List_Widget_Class_Method_DELETE_ITEM()
  404. {
  405.   LVAL self, lval_item;
  406.   Widget widget_id;
  407.   XmString str;
  408.  
  409.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  410.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  411.   xllastarg();
  412.  
  413.   XmListDeleteItem(widget_id, str);
  414.  
  415.   /* note: XmListDeleteItem() creates a copy of the XmString <item>,
  416.      allowing us to free str whenever we want. If <item> was passed in as an
  417.      XmString, the XmString will be freed via garbage collection whenever <item>
  418.      is no longer referenced. If <item> was passed in as a normal string, then a
  419.      new XmString object is created in this method -- it will be freed when it
  420.      gets garbage collected.  */
  421.   return (lval_item);        /* return the XmString item. */
  422. }
  423.  
  424.  
  425. #ifdef WINTERP_MOTIF_11
  426. /*****************************************************************************
  427.  * (send <listwidget> :DELETE_ITEMS <item-seq>)
  428.  *    ==> returns <listwidget>
  429.  *
  430.  * <item-seq> is a list or array of strings or XmStrings. Note that if 
  431.  * strings are given, they will automatically be converted to XmStrings
  432.  * before being passed to <listwidget>.
  433.  *
  434.  * This method deletes the specified <item-seq> from <listwidget>, giving
  435.  * an XtWarning if <item> doesn't exist.
  436.  * --------------------------------------------------------------------------
  437.  * void XmListDeleteItems (Widget w, XmString *items, int item_count);
  438.  ****************************************************************************/
  439. LVAL Xm_List_Widget_Class_Method_DELETE_ITEMS()
  440. {
  441.   LVAL self;
  442.   Widget widget_id;
  443.   SuperXmStringTable superstrtab;
  444.  
  445.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  446.   superstrtab = Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable(); /* get <item-seq> */
  447.   xllastarg();
  448.  
  449.   XmListDeleteItems(widget_id, superstrtab->xmstrtab, superstrtab->xmstrtab_end_idx);
  450.  
  451.   /* note: XmListDeleteItems() creates a copy of the XmStrings in <item-seq>, allowing us to
  452.      free all XmStrings created. */
  453.   Wxms_Free_SuperXmStringTable(superstrtab); /* dealloc any XmStrings created by autoconversion in Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable() */
  454.  
  455.   return (self);
  456. }
  457. #endif                /* WINTERP_MOTIF_11 */
  458.  
  459.  
  460. /*****************************************************************************
  461.  * (send <listwidget> :DELETE_POS <position>)
  462.  *    ==> returns <listwidget>.
  463.  * This method deletes the item at <position> from <listwidget>. A position
  464.  * of zero deletes the last item on the list. Gives an XtWarning if the 
  465.  * item doesn't exist.
  466.  * <position> is an positive fixnum. 
  467.  *
  468.  * void XmListDeletePos(w, pos)
  469.  *     Widget w;
  470.  *     int    pos;
  471.  ****************************************************************************/
  472. LVAL Xm_List_Widget_Class_Method_DELETE_POS()
  473. {
  474.   LVAL self;
  475.   int position;
  476.   Widget widget_id;
  477.  
  478.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  479.   position = Get_ListPosition_Argument(); /* get <position> */
  480.   xllastarg();
  481.  
  482.   XmListDeletePos(widget_id, position);
  483.  
  484.   return (self);
  485. }
  486.  
  487.  
  488. #ifdef WINTERP_MOTIF_11
  489. /*****************************************************************************
  490.  * (send <listwidget> :DELETE_ITEMS_POS <position> <item-count>)
  491.  *    ==> returns <listwidget>.
  492.  * This method deletes the items at <position> from <listwidget>. The number of
  493.  * items to delete at <position> is specified by <item-count>. A position
  494.  * of zero deletes the last item on the list. Gives an XtWarning if the 
  495.  * item doesn't exist.
  496.  * <position> is an positive fixnum. 
  497.  * <item-count> is an positive fixnum. 
  498.  *
  499.  * --------------------------------------------------------------------------
  500.  * void XmListDeleteItemsPos (Widget w, int item_count, int pos);
  501.  ****************************************************************************/
  502. LVAL Xm_List_Widget_Class_Method_DELETE_ITEMS_POS()
  503. {
  504.   LVAL self;
  505.   int position, item_count;
  506.   Widget widget_id;
  507.  
  508.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  509.   position = Get_ListPosition_Argument(); /* get <position> */
  510.   item_count = Get_ListPosition_Argument(); /* get <item-count> */
  511.   xllastarg();
  512.  
  513.   XmListDeleteItemsPos(widget_id, item_count, position);
  514.  
  515.   return (self);
  516. }
  517.  
  518.  
  519. /*****************************************************************************
  520.  * (send <listwidget> :DELETE_ALL_ITEMS)
  521.  *    ==> returns <listwidget>.
  522.  * --------------------------------------------------------------------------
  523.  * void XmListDeleteAllItems (Widget w);
  524.  ****************************************************************************/
  525. LVAL Xm_List_Widget_Class_Method_DELETE_ALL_ITEMS()
  526. {
  527.   LVAL self;
  528.   Widget widget_id;
  529.  
  530.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  531.   xllastarg();
  532.  
  533.   XmListDeleteAllItems(widget_id);
  534.  
  535.   return (self);
  536. }
  537.  
  538.  
  539. /*****************************************************************************
  540.  * (send <listwidget> :REPLACE_ITEMS <old-item-seq> <new-item-seq>)
  541.  *    ==> returns <listwidget>
  542.  *
  543.  * <old-item-seq> and <new-item-seq> is a list or array of strings or XmStrings.
  544.  * Note that if  strings are given, they will automatically be converted to
  545.  * XmStrings before being passed to <listwidget>.
  546.  *
  547.  * -------------------------------------------------------------------------
  548.  * void XmListReplaceItems (Widget w, XmString *old_items, int item_count, XmString *new_items);
  549.  ****************************************************************************/
  550. LVAL Xm_List_Widget_Class_Method_REPLACE_ITEMS()
  551. {
  552.   LVAL self;
  553.   Widget widget_id;
  554.   SuperXmStringTable old_superstrtab;
  555.   SuperXmStringTable new_superstrtab;
  556.  
  557.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  558.   old_superstrtab = Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable(); /* get <old-item-seq> */
  559.   new_superstrtab = Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable(); /* get <new-item-seq> */
  560.   xllastarg();
  561.   
  562.   XmListReplaceItems(widget_id, old_superstrtab->xmstrtab, old_superstrtab->xmstrtab_end_idx, new_superstrtab->xmstrtab);
  563.  
  564.   /* note: XmListReplaceItems() creates a copy of the XmStrings in <item-seq>,
  565.      allowing us to free all XmStrings created. */
  566.   Wxms_Free_SuperXmStringTable(old_superstrtab); /* this deallocs any XmStrings created by autoconversion in Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable() */
  567.   Wxms_Free_SuperXmStringTable(new_superstrtab); /* this deallocs any XmStrings created by autoconversion in Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable() */
  568.  
  569.   return (self);        /* <listwidget> */
  570. }
  571.  
  572.  
  573. /*****************************************************************************
  574.  * (send <listwidget> :REPLACE_ITEMS_POS <item-seq> <position>)
  575.  *    ==> returns <listwidget>
  576.  *
  577.  * This method replaces the items beginning at <position> with the items
  578.  * specified in <item-seq>. <item-seq> is a list or array of strings or
  579.  * XmStrings. Note that if  strings are given, they will automatically be
  580.  * converted to XmStrings before being passed to <listwidget>.
  581.  *
  582.  * -------------------------------------------------------------------------
  583.  * void XmListReplaceItemsPos (Widget w, XmString *new_items, int item_count, int position);
  584.  ****************************************************************************/
  585. LVAL Xm_List_Widget_Class_Method_REPLACE_ITEMS_POS()
  586. {
  587.   LVAL self;
  588.   int position;
  589.   Widget widget_id;
  590.   SuperXmStringTable superstrtab;
  591.  
  592.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  593.   superstrtab = Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable(); /* get <item-seq> */
  594.   position = Get_ListPosition_Argument(); /* get <position> */
  595.   xllastarg();
  596.  
  597.   XmListReplaceItemsPos(widget_id, superstrtab->xmstrtab, superstrtab->xmstrtab_end_idx, position);
  598.  
  599.   /* note: XmListReplaceItemsPos() creates a copy of the XmStrings in <item-seq>,
  600.      allowing us to free all XmStrings created. */
  601.   Wxms_Free_SuperXmStringTable(superstrtab); /* this deallocs any XmStrings created by autoconversion in Get_StringTable_or_XmStringTable_Arg_Returning_SuperXmStringTable() */
  602.  
  603.   return (self);        /* <listwidget> */
  604. }
  605. #endif                /* WINTERP_MOTIF_11 */
  606.  
  607.  
  608. /*****************************************************************************
  609.  * (send <listwidget> :SELECT_ITEM <item> [<notify_p>])
  610.  *    ==> returns <item> as an XmString
  611.  * This method adds <item> to the selected items list and highlights it.
  612.  * <item> is a string or XmString. If <item> is given as a string, it
  613.  *    is converted to an XmString and that XmString is returned by the method.
  614.  * <notify_p> is an optional boolean parameter. If non-NIL, it will issue a
  615.  *    callback indicating an item has been selected.
  616.  *
  617.  * void XmListSelectItem(w, item, notify)
  618.  *     Widget w;
  619.  *     XmString item;
  620.  *     Boolean notify;
  621.  ****************************************************************************/
  622. LVAL Xm_List_Widget_Class_Method_SELECT_ITEM()
  623. {
  624.   LVAL self, lval_item;
  625.   Widget widget_id;
  626.   XmString str;
  627.   Boolean notify_p;
  628.  
  629.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  630.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  631.   if (moreargs())        /* get optional <notify_p> */
  632.     notify_p = nextarg() ? TRUE : FALSE;
  633.   else
  634.     notify_p = FALSE;
  635.   xllastarg();
  636.  
  637.   XmListSelectItem(widget_id, str, notify_p);
  638.  
  639.   /* note: XmListSelectItem() creates a copy of the XmString <item>,
  640.      allowing us to free str whenever we want. If <item> was passed in as an
  641.      XmString, the XmString will be freed via garbage collection whenever <item>
  642.      is no longer referenced. If <item> was passed in as a normal string, then a
  643.      new XmString object is created in this method -- it will be freed when it
  644.      gets garbage collected.  */
  645.   return (lval_item);        /* return the XmString item. */
  646. }
  647.  
  648.  
  649. /*****************************************************************************
  650.  * (send <listwidget> :SELECT_POS <position> [<notify_p>])
  651.  *    ==> returns <listwidget>.
  652.  * This method adds the item corresponding to <position> to the selected
  653.  * items list and highlights it.
  654.  * <position> is an positive fixnum. 
  655.  * <notify_p> is an optional boolean parameter. If non-NIL, it will issue a
  656.  *    callback indicating an item has been selected.
  657.  *
  658.  * void XmListSelectPos(w, pos, notify)
  659.  *     Widget w;
  660.  *     int    pos;
  661.  *     Boolean notify;
  662.  ****************************************************************************/
  663. LVAL Xm_List_Widget_Class_Method_SELECT_POS()
  664. {
  665.   LVAL self;
  666.   int position;
  667.   Widget widget_id;
  668.   Boolean notify_p;
  669.  
  670.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  671.   position = Get_ListPosition_Argument(); /* get <position> */
  672.   if (moreargs())        /* get optional <notify_p> */
  673.     notify_p = nextarg() ? TRUE : FALSE;
  674.   else
  675.     notify_p = FALSE;
  676.   xllastarg();
  677.  
  678.   XmListSelectPos(widget_id, position, notify_p);
  679.  
  680.   return (self);
  681. }
  682.  
  683.  
  684. /*****************************************************************************
  685.  * (send <listwidget> :DESELECT_ITEM <item>)
  686.  *    ==> returns <item> as an XmString
  687.  * This method removes the specified <item> from the selected list and
  688.  * unhighlights it.
  689.  * <item> is a string or XmString. If <item> is given as a string, it
  690.  *    is converted to an XmString and that XmString is returned by the method.
  691.  *
  692.  * void XmListDeselectItem(w, item)
  693.  *     Widget w;
  694.  *     XmString item;
  695.  ****************************************************************************/
  696. LVAL Xm_List_Widget_Class_Method_DESELECT_ITEM()
  697. {
  698.   LVAL self, lval_item;
  699.   Widget widget_id;
  700.   XmString str;
  701.  
  702.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  703.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  704.   xllastarg();
  705.  
  706.   XmListDeselectItem(widget_id, str);
  707.  
  708.   /* note: XmListDeselectItem() creates a copy of the XmString <item>,
  709.      allowing us to free str whenever we want. If <item> was passed in as an
  710.      XmString, the XmString will be freed via garbage collection whenever <item>
  711.      is no longer referenced. If <item> was passed in as a normal string, then a
  712.      new XmString object is created in this method -- it will be freed when it
  713.      gets garbage collected.  */
  714.   return (lval_item);        /* return the XmString item. */
  715. }
  716.  
  717.  
  718. /*****************************************************************************
  719.  * (send <listwidget> :DESELECT_POS <position>)
  720.  *    ==> returns <listwidget>.
  721.  * This method removes the item associated with <position> from the
  722.  * selected list and unhighlights it.
  723.  * <position> is an positive fixnum. 
  724.  *
  725.  * void XmListDeselectPos(w, pos)
  726.  *     Widget w;
  727.  *     int    pos;
  728.  ****************************************************************************/
  729. LVAL Xm_List_Widget_Class_Method_DESELECT_POS()
  730. {
  731.   LVAL self;
  732.   int position;
  733.   Widget widget_id;
  734.  
  735.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  736.   position = Get_ListPosition_Argument(); /* get <position> */
  737.   xllastarg();
  738.  
  739.   XmListDeselectPos(widget_id, position);
  740.  
  741.   return (self);
  742. }
  743.  
  744.  
  745. /*****************************************************************************
  746.  * (send <listwidget> :DESELECT_ALL_ITEMS)
  747.  *    ==> returns <listwidget>.
  748.  * This method unhighlighs all selected items and removes all items from the
  749.  * selected items list.
  750.  *
  751.  * void XmListDeselectAllItems(w)
  752.  *     Widget w;
  753.  ****************************************************************************/
  754. LVAL Xm_List_Widget_Class_Method_DESELECT_ALL_ITEMS()
  755. {
  756.   LVAL self;
  757.   Widget widget_id;
  758.  
  759.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  760.   xllastarg();
  761.  
  762.   XmListDeselectAllItems(widget_id);
  763.   return (self);
  764. }
  765.  
  766.  
  767. /*****************************************************************************
  768.  * (send <listwidget> :SET_POS <position>)
  769.  *    ==> returns <listwidget>.
  770.  * This method makes the item associated with <position> be the first
  771.  * visible element of the list.
  772.  * <position> is an positive fixnum. 
  773.  *
  774.  * void XmListSetPos(w, pos)
  775.  *     Widget w;
  776.  *     int    pos;
  777.  ****************************************************************************/
  778. LVAL Xm_List_Widget_Class_Method_SET_POS()
  779. {
  780.   LVAL self;
  781.   int position;
  782.   Widget widget_id;
  783.  
  784.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  785.   position = Get_ListPosition_Argument(); /* get <position> */
  786.   xllastarg();
  787.  
  788.   XmListSetPos(widget_id, position);
  789.  
  790.   return (self);
  791. }
  792.  
  793.  
  794. /*****************************************************************************
  795.  * (send <listwidget> :SET_BOTTOM_POS <position>)
  796.  *    ==> returns <listwidget>.
  797.  * This method makes the item associated with <position> be the last visible
  798.  * position in the list.
  799.  * <position> is an positive fixnum. 
  800.  *
  801.  * void XmListSetBottomPos(w, pos)
  802.  *     Widget w;
  803.  *     int    pos;
  804.  ****************************************************************************/
  805. LVAL Xm_List_Widget_Class_Method_SET_BOTTOM_POS()
  806. {
  807.   LVAL self;
  808.   int position;
  809.   Widget widget_id;
  810.  
  811.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  812.   position = Get_ListPosition_Argument(); /* get <position> */
  813.   xllastarg();
  814.  
  815.   XmListSetBottomPos(widget_id, position);
  816.  
  817.   return (self);
  818. }
  819.  
  820.  
  821. /*****************************************************************************
  822.  * (send <listwidget> :SET_ITEM <item>)
  823.  *    ==> returns <item> as an XmString
  824.  * This method makes <item> be the first visible item in the list.
  825.  * <item> is a string or XmString. If <item> is given as a string, it
  826.  *    is converted to an XmString and that XmString is returned by the method.
  827.  *
  828.  * void XmListSetItem(w, item)
  829.  *     Widget w;
  830.  *     XmString item;
  831.  ****************************************************************************/
  832. LVAL Xm_List_Widget_Class_Method_SET_ITEM()
  833. {
  834.   LVAL self, lval_item;
  835.   Widget widget_id;
  836.   XmString str;
  837.  
  838.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  839.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  840.   xllastarg();
  841.  
  842.   XmListSetItem(widget_id, str);
  843.  
  844.   /* note: XmListSetItem() creates a copy of the XmString <item>,
  845.      allowing us to free str whenever we want. If <item> was passed in as an
  846.      XmString, the XmString will be freed via garbage collection whenever <item>
  847.      is no longer referenced. If <item> was passed in as a normal string, then a
  848.      new XmString object is created in this method -- it will be freed when it
  849.      gets garbage collected.  */
  850.   return (lval_item);        /* return the XmString item. */
  851. }
  852.  
  853.  
  854. /*****************************************************************************
  855.  * (send <listwidget> :SET_BOTTOM_ITEM <item>)
  856.  *    ==> returns <item> as an XmString
  857.  * This method makes <item> be the last visible position in the list.
  858.  * <item> is a string or XmString. If <item> is given as a string, it
  859.  *    is converted to an XmString and that XmString is returned by the method.
  860.  *
  861.  * void XmListSetBottomItem(w, item)
  862.  *     Widget w;
  863.  *     XmString       item;
  864.  ****************************************************************************/
  865. LVAL Xm_List_Widget_Class_Method_SET_BOTTOM_ITEM()
  866. {
  867.   LVAL self, lval_item;
  868.   Widget widget_id;
  869.   XmString str;
  870.  
  871.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  872.   str = Get_String_or_XmString_Arg_Returning_XmString(&lval_item); /* get <item> */
  873.   xllastarg();
  874.  
  875.   XmListSetBottomItem(widget_id, str);
  876.  
  877.   /* note: XmListSetBottomItem() creates a copy of the XmString <item>,
  878.      allowing us to free str whenever we want. If <item> was passed in as an
  879.      XmString, the XmString will be freed via garbage collection whenever <item>
  880.      is no longer referenced. If <item> was passed in as a normal string, then a
  881.      new XmString object is created in this method -- it will be freed when it
  882.      gets garbage collected.  */
  883.   return (lval_item);        /* return the XmString item. */
  884. }
  885.  
  886.  
  887. #ifdef WINTERP_MOTIF_11
  888. /*****************************************************************************
  889.  * (send <listwidget> :SET_ADD_MODE <add-mode-p>)
  890.  *    ==> returns <listwidget>
  891.  *
  892.  * <add-mode-p> is a boolean. If <add-mode-p> non-NIL, then <listwidget>
  893.  * will be set into add mode.
  894.  *
  895.  * --------------------------------------------------------------------------
  896.  * void XmListSetAddMode (Widget w, Boolean add_mode);
  897.  ****************************************************************************/
  898. LVAL Xm_List_Widget_Class_Method_SET_ADD_MODE()
  899. {
  900.   LVAL self, lval_add_mode_p;
  901.   Widget widget_id;
  902.  
  903.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  904.   lval_add_mode_p = xlgetarg(); /* get <add-mode-p> */
  905.   xllastarg();
  906.  
  907.   XmListSetAddMode(widget_id, (lval_add_mode_p) ? TRUE : FALSE);
  908.  
  909.   return (self);
  910. }
  911. #endif                /* WINTERP_MOTIF_11 */
  912.  
  913.  
  914. /*****************************************************************************
  915.  * (send <listwidget> :ITEM_EXISTS <item>)
  916.  *    ==> returns T if the item is in the specified list widget, else NIL.
  917.  * <item> is a string or XmString. If <item> is given as a string, it
  918.  *    is converted to an XmString.
  919.  *
  920.  * Boolean XmListItemExists(w, item)
  921.  *     Widget w;
  922.  *     XmString item;
  923.  ****************************************************************************/
  924. LVAL Xm_List_Widget_Class_Method_ITEM_EXISTS()
  925. {
  926.   extern LVAL true;
  927.   Boolean result;
  928.   LVAL self, lval_item;
  929.   Widget widget_id;
  930.   XmString str;
  931.  
  932.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  933.   if (moreargs() && stringp(*xlargv)) {    /* get <item> */
  934.     str = XmStringCreate((char*) getstring(nextarg()), XmSTRING_DEFAULT_CHARSET);
  935.     lval_item = NIL;
  936.   }
  937.   else if (moreargs() && xmstring_p(*xlargv)) {
  938.     lval_item = nextarg();
  939.     str = get_xmstring(lval_item);
  940.   }
  941.   else
  942.     xlerror("Bad List-Item type: expected an XmString or a string.", *xlargv);
  943.   xllastarg();
  944.  
  945.   result = XmListItemExists(widget_id, str);
  946.  
  947.   if (lval_item == NIL)        /* free the XmString only if we created it here ... note that we can't rely on gc to free the XmStrings since we can't return the XmString from this method */
  948.     XmStringFree(str);
  949.  
  950.   return (result ? true : NIL);
  951. }
  952.  
  953.  
  954. #ifdef WINTERP_MOTIF_11
  955. /*****************************************************************************
  956.  * (send <listwidget> :ITEM_POS <item>)
  957.  *    ==> returns FIXNUM position of <item> in <listwidget>. If <item>
  958.  *    doesn't exist, returns NIL.
  959.  *
  960.  * <item> is a string or XmString. If <item> is given as a string, it
  961.  *    is converted to an XmString.
  962.  * --------------------------------------------------------------------------
  963.  * int XmListItemPos (Widget w, XmString item);
  964.  ****************************************************************************/
  965. LVAL Xm_List_Widget_Class_Method_ITEM_POS()
  966. {
  967.   LVAL self, lval_item;
  968.   Widget widget_id;
  969.   XmString str;
  970.   int result;
  971.  
  972.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  973.   if (moreargs() && stringp(*xlargv)) {    /* get <item> */
  974.     str = XmStringCreate((char*) getstring(nextarg()), XmSTRING_DEFAULT_CHARSET);
  975.     lval_item = NIL;
  976.   }
  977.   else if (moreargs() && xmstring_p(*xlargv)) {
  978.     lval_item = nextarg();
  979.     str = get_xmstring(lval_item);
  980.   }
  981.   else
  982.     xlerror("Bad List-Item type: expected an XmString or a string.", *xlargv);
  983.   xllastarg();
  984.  
  985.   result = XmListItemPos(widget_id, str);
  986.  
  987.   if (lval_item == NIL)        /* free the XmString only if we created it here ... note that we can't rely on gc to free the XmStrings since we can't return the XmString from this method */
  988.     XmStringFree(str);
  989.  
  990.   return (result ? cvfixnum((FIXTYPE) result) : NIL);
  991. }
  992.  
  993.  
  994. /*****************************************************************************
  995.  * (send <listwidget> :GET_MATCH_POS <item>)
  996.  *    ==> returns an array of FIXNUMS, each representing the position of <item>
  997.  *          in <listwidget>. returns NIL if no matches found for <item>.
  998.  *
  999.  * <item> is a string or XmString. If <item> is given as a string, it
  1000.  *    is converted to an XmString.
  1001.  * --------------------------------------------------------------------------
  1002.  * Boolean XmListGetMatchPos (Widget w, XmString item, int **pos_list, int *pos_count);
  1003.  ****************************************************************************/
  1004. LVAL Xm_List_Widget_Class_Method_GET_MATCH_POS()
  1005. {
  1006.   LVAL self, lval_item, lval_result;
  1007.   Widget widget_id;
  1008.   XmString str;
  1009.   Boolean result;
  1010.   int* position_list;
  1011.   int position_count;
  1012.  
  1013.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  1014.   if (moreargs() && stringp(*xlargv)) {    /* get <item> */
  1015.     str = XmStringCreate((char*) getstring(nextarg()), XmSTRING_DEFAULT_CHARSET);
  1016.     lval_item = NIL;
  1017.   }
  1018.   else if (moreargs() && xmstring_p(*xlargv)) {
  1019.     lval_item = nextarg();
  1020.     str = get_xmstring(lval_item);
  1021.   }
  1022.   else
  1023.     xlerror("Bad List-Item type: expected an XmString or a string.", *xlargv);
  1024.   xllastarg();
  1025.  
  1026.   result = XmListGetMatchPos(widget_id, str, &position_list, &position_count);
  1027.  
  1028.   if (lval_item == NIL)        /* free the XmString only if we created it here ... note that we can't rely on gc to free the XmStrings since we can't return the XmString from this method */
  1029.     XmStringFree(str);
  1030.  
  1031.   if (!result)
  1032.     return (NIL);
  1033.   else {
  1034.     lval_result = IntList_To_Lisp_Vector(position_list, position_count);
  1035.     XtFree(position_list);
  1036.     return (lval_result);
  1037.   }
  1038. }
  1039.  
  1040.  
  1041. /*****************************************************************************
  1042.  * (send <listwidget> :GET_SELECTED_POS)
  1043.  *    ==> returns an array of FIXNUMS, each representing the position of the
  1044.  *          selected items in <listwidget>. returns NIL if there are no selected
  1045.  *          items.
  1046.  *
  1047.  * --------------------------------------------------------------------------
  1048.  * Boolean XmListGetSelectedPos (Widget w, int **pos_list, int *pos_count);
  1049.  ****************************************************************************/
  1050. LVAL Xm_List_Widget_Class_Method_GET_SELECTED_POS()
  1051. {
  1052.   LVAL self, lval_result;
  1053.   Widget widget_id;
  1054.   Boolean result;
  1055.   int* position_list;
  1056.   int position_count;
  1057.  
  1058.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  1059.   xllastarg();
  1060.  
  1061.   result = XmListGetSelectedPos(widget_id, &position_list, &position_count);
  1062.  
  1063.   if (!result)
  1064.     return (NIL);
  1065.   else {
  1066.     lval_result = IntList_To_Lisp_Vector(position_list, position_count);
  1067.     XtFree(position_list);
  1068.     return (lval_result);
  1069.   }
  1070. }
  1071. #endif                /* WINTERP_MOTIF_11 */
  1072.  
  1073.  
  1074. /*****************************************************************************
  1075.  * (send <listwidget> :SET_HORIZ_POS <position>)
  1076.  *    ==> returns <listwidget>.
  1077.  * This method scrolls the list horizontally such that the scrollbar reflects
  1078.  * <position> in the list.
  1079.  * <position> is an positive fixnum. 
  1080.  *
  1081.  * void XmListSetHorizPos(w, position)
  1082.  * Widget w;
  1083.  * int    position;
  1084.  ****************************************************************************/
  1085. LVAL Xm_List_Widget_Class_Method_SET_HORIZ_POS()
  1086. {
  1087.   LVAL self;
  1088.   int position;
  1089.   Widget widget_id;
  1090.  
  1091.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /* get <listwidget> */
  1092.   position = Get_ListPosition_Argument(); /* get <position> */
  1093.   xllastarg();
  1094.  
  1095.   XmListSetHorizPos(widget_id, position);
  1096.  
  1097.   return (self);
  1098. }
  1099.  
  1100.  
  1101. /******************************************************************************
  1102.  * typedef struct
  1103.  * {
  1104.  *    int     reason;
  1105.  *    XEvent    *event;
  1106.  *    XmString  item;
  1107.  *    int       item_length;
  1108.  *    int       item_position;
  1109.  *    XmString  *selected_items;
  1110.  *    int       selected_item_count;
  1111.  *    int       *selected_item_positions;  -- THIS FIELD EXISTS ONLY IN MOTIF 1.1
  1112.  *    int       selection_type;
  1113.  * } XmListCallbackStruct;
  1114.  ******************************************************************************/
  1115. static LVAL s_INITIAL, s_ADDITION, s_MODIFICATION;
  1116. static LVAL s_CALLBACK_ITEM, s_CALLBACK_ITEM_LENGTH,
  1117.   s_CALLBACK_ITEM_POSITION, s_CALLBACK_SELECTED_ITEMS,
  1118.   s_CALLBACK_SELECTED_ITEM_COUNT, s_CALLBACK_SELECTION_TYPE;
  1119. #ifdef WINTERP_MOTIF_11
  1120. static LVAL s_CALLBACK_SELECTED_ITEM_POSITIONS;
  1121. #endif                /* WINTERP_MOTIF_11 */
  1122.  
  1123. static void Lexical_Bindings_For_XmListCallbackStruct(bindings_list, lexical_env, cd, o_widget)
  1124.      LVAL      bindings_list;    /* a list of symbols to which values from XmListCallbackStruct are bound */
  1125.      LVAL      lexical_env;        
  1126.      XmListCallbackStruct* cd;
  1127.      LVAL      o_widget;    /* XLTYPE_WIDGETOBJ */
  1128. {
  1129.   extern LVAL s_CALLBACK_WIDGET, s_CALLBACK_REASON, s_CALLBACK_XEVENT; /* w_callbacks.c */
  1130.   extern LVAL Wcb_Get_Callback_Reason_Symbol();    /* w_callbacks.c */
  1131.   register LVAL s_bindname;
  1132.  
  1133.   switch (cd->reason) {
  1134.  
  1135.   case XmCR_SINGLE_SELECT:    /* valid XmListCallbackStruct fields: reason, event, item, item_length, item_position */
  1136.   case XmCR_DEFAULT_ACTION:    /* valid XmListCallbackStruct fields: reason, event, item, item_length, item_position */
  1137.   case XmCR_BROWSE_SELECT:    /* valid XmListCallbackStruct fields: reason, event, item, item_length, item_position */
  1138.  
  1139.     for ( ; consp(bindings_list); bindings_list = cdr(bindings_list)) {
  1140.       s_bindname = car(bindings_list);
  1141.  
  1142.       if (s_bindname == s_CALLBACK_WIDGET) {
  1143.     xlpbind(s_bindname, o_widget, lexical_env); /* add binding to lexical_env */
  1144.       }
  1145.       else if (s_bindname == s_CALLBACK_REASON) {
  1146.     xlpbind(s_bindname, Wcb_Get_Callback_Reason_Symbol(cd->reason), lexical_env);
  1147.       }
  1148.       else if (s_bindname == s_CALLBACK_XEVENT) {
  1149.     xlpbind(s_bindname, (cd->event) ? cv_xevent(cd->event) : NIL, lexical_env);
  1150.       }
  1151.       else if (s_bindname == s_CALLBACK_ITEM) {
  1152.     xlpbind(s_bindname, (cd->item) ? cv_xmstring(XmStringCopy(cd->item)) : NIL, lexical_env); /* the copied XmString may be dealloc'd later by gc */
  1153.       }
  1154.       else if (s_bindname == s_CALLBACK_ITEM_LENGTH) {
  1155.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->item_length), lexical_env);
  1156.       }
  1157.       else if (s_bindname == s_CALLBACK_ITEM_POSITION) {
  1158.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->item_position), lexical_env);
  1159.       }
  1160.       else {
  1161.     extern char temptext[];    /* from winterp.c */
  1162.     sprintf(temptext,
  1163.         "Unknown binding name in XmListCallbackStruct callback evaluator for\n\tCALLBACK_REASON == CR_SINGLE_SELECT, CR_DEFAULT_ACTION, CR_BROWSE_SELECT.\n\tValid symbols are [%s %s %s %s %s %s].",
  1164.         (char*) getstring(getpname(s_CALLBACK_WIDGET)),
  1165.         (char*) getstring(getpname(s_CALLBACK_REASON)),
  1166.         (char*) getstring(getpname(s_CALLBACK_XEVENT)),
  1167.         (char*) getstring(getpname(s_CALLBACK_ITEM)),
  1168.         (char*) getstring(getpname(s_CALLBACK_ITEM_LENGTH)),
  1169.         (char*) getstring(getpname(s_CALLBACK_ITEM_POSITION)));
  1170.     xlerror(temptext, s_bindname);
  1171.       }
  1172.     }
  1173.     break;
  1174.  
  1175.   case XmCR_MULTIPLE_SELECT:    /* valid XmListCallbackStruct fields: reason, event, item, item_length, item_position, selected_items, selected_item_count, selected_item_positions */
  1176.  
  1177.     for ( ; consp(bindings_list); bindings_list = cdr(bindings_list)) {
  1178.       s_bindname = car(bindings_list);
  1179.  
  1180.       if (s_bindname == s_CALLBACK_WIDGET) {
  1181.     xlpbind(s_bindname, o_widget, lexical_env); /* add binding to lexical_env */
  1182.       }
  1183.       else if (s_bindname == s_CALLBACK_REASON) {
  1184.     xlpbind(s_bindname, Wcb_Get_Callback_Reason_Symbol(cd->reason), lexical_env);
  1185.       }
  1186.       else if (s_bindname == s_CALLBACK_XEVENT) {
  1187.     xlpbind(s_bindname, (cd->event) ? cv_xevent(cd->event) : NIL, lexical_env);
  1188.       }
  1189.       else if (s_bindname == s_CALLBACK_ITEM) {
  1190.     xlpbind(s_bindname, (cd->item) ? cv_xmstring(XmStringCopy(cd->item)) : NIL, lexical_env); /* the copied XmString may be dealloc'd later by gc */
  1191.       }
  1192.       else if (s_bindname == s_CALLBACK_ITEM_LENGTH) {
  1193.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->item_length), lexical_env);
  1194.       }
  1195.       else if (s_bindname == s_CALLBACK_ITEM_POSITION) {
  1196.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->item_position), lexical_env);
  1197.       }
  1198.       else if (s_bindname == s_CALLBACK_SELECTED_ITEMS) {
  1199.     xlpbind(s_bindname, Wxms_XmStringTable_To_Lisp_Vector(cd->selected_items, cd->selected_item_count), lexical_env); /* the vector and it's constituent XmStrings may be freed later via gc */
  1200.       }
  1201.       else if (s_bindname == s_CALLBACK_SELECTED_ITEM_COUNT) {
  1202.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->selected_item_count), lexical_env);
  1203.       }
  1204. #ifdef WINTERP_MOTIF_11
  1205.       else if (s_bindname == s_CALLBACK_SELECTED_ITEM_POSITIONS) {
  1206.     xlpbind(s_bindname, IntList_To_Lisp_Vector(cd->selected_item_positions, cd->selected_item_count), lexical_env); /* the vector and it's constituent FIXNUMs may be freed later via gc */
  1207.       }
  1208. #endif                /* WINTERP_MOTIF_11 */
  1209.       else {
  1210.     extern char temptext[];    /* from winterp.c */
  1211.     sprintf(temptext,
  1212. #ifdef WINTERP_MOTIF_11
  1213.         "Unknown binding name in XmListCallbackStruct callback evaluator for\n\tCALLBACK_REASON == CR_MULTIPLE_SELECT.\n\tValid symbols are [%s %s %s %s %s %s %s %s %s].",
  1214. #else                /* MOTIF 1.0 */
  1215.         "Unknown binding name in XmListCallbackStruct callback evaluator for\n\tCALLBACK_REASON == CR_MULTIPLE_SELECT.\n\tValid symbols are [%s %s %s %s %s %s %s %s].",
  1216. #endif                /* WINTERP_MOTIF_11 */
  1217.         (char*) getstring(getpname(s_CALLBACK_WIDGET)),
  1218.         (char*) getstring(getpname(s_CALLBACK_REASON)),
  1219.         (char*) getstring(getpname(s_CALLBACK_XEVENT)),
  1220.         (char*) getstring(getpname(s_CALLBACK_ITEM)),
  1221.         (char*) getstring(getpname(s_CALLBACK_ITEM_LENGTH)),
  1222.         (char*) getstring(getpname(s_CALLBACK_ITEM_POSITION)),
  1223.         (char*) getstring(getpname(s_CALLBACK_SELECTED_ITEMS)),
  1224. #ifdef WINTERP_MOTIF_11
  1225.         (char*) getstring(getpname(s_CALLBACK_SELECTED_ITEM_POSITIONS)),
  1226. #endif                /* WINTERP_MOTIF_11 */
  1227.         (char*) getstring(getpname(s_CALLBACK_SELECTED_ITEM_COUNT)));
  1228.     xlerror(temptext, s_bindname);
  1229.       }
  1230.     }
  1231.     break;
  1232.  
  1233.   case XmCR_EXTENDED_SELECT:    /* valid XmListCallbackStruct fields: reason, event, item, item_length, item_position, selected_items, selected_item_count, selected_item_positions, selection_type */
  1234.  
  1235.     for ( ; consp(bindings_list); bindings_list = cdr(bindings_list)) {
  1236.       s_bindname = car(bindings_list);
  1237.  
  1238.       if (s_bindname == s_CALLBACK_WIDGET) {
  1239.     xlpbind(s_bindname, o_widget, lexical_env); /* add binding to lexical_env */
  1240.       }
  1241.       else if (s_bindname == s_CALLBACK_REASON) {
  1242.     xlpbind(s_bindname, Wcb_Get_Callback_Reason_Symbol(cd->reason), lexical_env);
  1243.       }
  1244.       else if (s_bindname == s_CALLBACK_XEVENT) {
  1245.     xlpbind(s_bindname, (cd->event) ? cv_xevent(cd->event) : NIL, lexical_env);
  1246.       }
  1247.       else if (s_bindname == s_CALLBACK_ITEM) {
  1248.     xlpbind(s_bindname, (cd->item) ? cv_xmstring(XmStringCopy(cd->item)) : NIL, lexical_env); /* the copied XmString may be dealloc'd later by gc */
  1249.       }
  1250.       else if (s_bindname == s_CALLBACK_ITEM_LENGTH) {
  1251.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->item_length), lexical_env);
  1252.       }
  1253.       else if (s_bindname == s_CALLBACK_ITEM_POSITION) {
  1254.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->item_position), lexical_env);
  1255.       }
  1256.       else if (s_bindname == s_CALLBACK_SELECTED_ITEMS) {
  1257.     xlpbind(s_bindname, Wxms_XmStringTable_To_Lisp_Vector(cd->selected_items, cd->selected_item_count), lexical_env); /* the vector and it's constituent XmStrings may be freed later via gc */
  1258.       }
  1259.       else if (s_bindname == s_CALLBACK_SELECTED_ITEM_COUNT) {
  1260.     xlpbind(s_bindname, cvfixnum((FIXTYPE) cd->selected_item_count), lexical_env);
  1261.       }
  1262. #ifdef WINTERP_MOTIF_11
  1263.       else if (s_bindname == s_CALLBACK_SELECTED_ITEM_POSITIONS) {
  1264.     xlpbind(s_bindname, IntList_To_Lisp_Vector(cd->selected_item_positions, cd->selected_item_count), lexical_env); /* the vector and it's constituent FIXNUMs may be freed later via gc */
  1265.       }
  1266. #endif                /* WINTERP_MOTIF_11 */
  1267.       else if (s_bindname == s_CALLBACK_SELECTION_TYPE)
  1268.     switch (cd->selection_type) {
  1269.     case XmINITIAL:
  1270.       xlpbind(s_bindname, s_INITIAL, lexical_env);
  1271.       break;
  1272.     case XmADDITION:
  1273.       xlpbind(s_bindname, s_ADDITION, lexical_env);
  1274.       break;
  1275.     case XmMODIFICATION:
  1276.       xlpbind(s_bindname, s_MODIFICATION, lexical_env);
  1277.       break;
  1278.     default:
  1279.       xlfail("Internal error in Lexical_Bindings_For_XmListCallbackStruct() -- unknown cb->selection_type.");
  1280.       break;
  1281.     }
  1282.       else {
  1283.     extern char temptext[];    /* from winterp.c */
  1284.     sprintf(temptext,
  1285. #ifdef WINTERP_MOTIF_11
  1286.         "Unknown binding name in XmListCallbackStruct callback evaluator for\n\tCALLBACK_REASON == CR_EXTENDED_SELECT.\n\tValid symbols are [%s %s %s %s %s %s %s %s %s %s].",
  1287. #else                /* MOTIF 1.0 */
  1288.         "Unknown binding name in XmListCallbackStruct callback evaluator for\n\tCALLBACK_REASON == CR_EXTENDED_SELECT.\n\tValid symbols are [%s %s %s %s %s %s %s %s %s].",
  1289. #endif                /* WINTERP_MOTIF_11 */
  1290.         (char*) getstring(getpname(s_CALLBACK_WIDGET)),
  1291.         (char*) getstring(getpname(s_CALLBACK_REASON)),
  1292.         (char*) getstring(getpname(s_CALLBACK_XEVENT)),
  1293.         (char*) getstring(getpname(s_CALLBACK_ITEM)),
  1294.         (char*) getstring(getpname(s_CALLBACK_ITEM_LENGTH)),
  1295.         (char*) getstring(getpname(s_CALLBACK_ITEM_POSITION)),
  1296.         (char*) getstring(getpname(s_CALLBACK_SELECTED_ITEMS)),
  1297.         (char*) getstring(getpname(s_CALLBACK_SELECTED_ITEM_COUNT)),
  1298. #ifdef WINTERP_MOTIF_11
  1299.         (char*) getstring(getpname(s_CALLBACK_SELECTED_ITEM_POSITIONS)),
  1300. #endif                /* WINTERP_MOTIF_11 */
  1301.         (char*) getstring(getpname(s_CALLBACK_SELECTION_TYPE)));
  1302.     xlerror(temptext, s_bindname);
  1303.       }
  1304.     }
  1305.     break;
  1306.   }
  1307. }
  1308.  
  1309.  
  1310. /*******************************************************************************
  1311.  * This is called indirectly via XtAddCallback() for callbacks returning
  1312.  * an XmListCallbackStruct as call_data.
  1313.  ******************************************************************************/
  1314. static void XmListCallbackStruct_Callbackproc(widget, client_data, call_data)
  1315.      Widget    widget;
  1316.      XtPointer client_data;
  1317.      XtPointer call_data;
  1318. {
  1319.   extern void Wcb_Meta_Callbackproc();    /* w_callbacks.c */
  1320.  
  1321.   Wcb_Meta_Callbackproc(client_data, call_data,
  1322.             Lexical_Bindings_For_XmListCallbackStruct,
  1323.             NULL);
  1324. }
  1325.  
  1326.  
  1327. /******************************************************************************
  1328.  * Same as WIDGET_CLASS's :add_callback method except that this understands
  1329.  * how to get values from the XmListCallbackStruct.
  1330.  * Specifying one or more of the following symbols in the callback bindings 
  1331.  * list will bind that symbol's value in the lexical environment of the callback:
  1332.  * CALLBACK_WIDGET
  1333.  * CALLBACK_REASON
  1334.  * CALLBACK_XEVENT
  1335.  * CALLBACK_ITEM
  1336.  * CALLBACK_ITEM_LENGTH
  1337.  * CALLBACK_ITEM_POSITION
  1338.  * CALLBACK_SELECTED_ITEMS
  1339.  * CALLBACK_SELECTED_ITEM_COUNT
  1340.  * CALLBACK_SELECTION_TYPE
  1341.  * CALLBACK_SELECTED_ITEM_POSITION -- new for motif 1.1
  1342.  ******************************************************************************/
  1343. LVAL Xm_List_Widget_Class_Method_ADD_CALLBACK()
  1344. {
  1345.   extern LVAL Wcb_Meta_Method_Add_Callback(); /* w_callbacks.c */
  1346.  
  1347.   return (Wcb_Meta_Method_Add_Callback(XmListCallbackStruct_Callbackproc, FALSE));
  1348. }
  1349.  
  1350.  
  1351. /******************************************************************************
  1352.  * Same as WIDGET_CLASS's :set_callback method except that this understands
  1353.  * how to get values from the XmListCallbackStruct.
  1354.  * Specifying one or more of the following symbols in the callback bindings 
  1355.  * list will bind that symbol's value in the lexical environment of the callback:
  1356.  * CALLBACK_WIDGET
  1357.  * CALLBACK_REASON
  1358.  * CALLBACK_XEVENT
  1359.  * CALLBACK_ITEM
  1360.  * CALLBACK_ITEM_LENGTH
  1361.  * CALLBACK_ITEM_POSITION
  1362.  * CALLBACK_SELECTED_ITEMS
  1363.  * CALLBACK_SELECTED_ITEM_COUNT
  1364.  * CALLBACK_SELECTION_TYPE
  1365.  * CALLBACK_SELECTED_ITEM_POSITION -- new for motif 1.1
  1366.  ******************************************************************************/
  1367. LVAL Xm_List_Widget_Class_Method_SET_CALLBACK()
  1368. {
  1369.   extern LVAL Wcb_Meta_Method_Add_Callback(); /* w_callbacks.c */
  1370.  
  1371.   return (Wcb_Meta_Method_Add_Callback(XmListCallbackStruct_Callbackproc, TRUE));
  1372. }
  1373.  
  1374.  
  1375. /******************************************************************************
  1376.  * (send <listwidget> :GET_ITEMS)
  1377.  *     ==> returns an array of XmStrings.
  1378.  *
  1379.  * This retrieves the XmList widget resources XmNitems and XmNitemCount
  1380.  * from <listwidget> and returns an array of XmStrings
  1381.  * representing the items in the list.
  1382.  *******************************************************************************/
  1383. LVAL Xm_List_Widget_Class_Method_GET_ITEMS()
  1384. {
  1385.   LVAL self;
  1386.   Widget widget_id;
  1387.   XmStringTable xmstrtab;
  1388.   int        xmstrtab_size;
  1389.  
  1390.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  1391.   xllastarg();
  1392.  
  1393.   ARGLIST_RESET();
  1394.   ARGLIST_ADD(XmNitems, &xmstrtab);
  1395.   ARGLIST_ADD(XmNitemCount, &xmstrtab_size);
  1396.   XtGetValues(widget_id, ARGLIST());
  1397.  
  1398.   return (Wxms_XmStringTable_To_Lisp_Vector(xmstrtab, xmstrtab_size));
  1399. }
  1400.  
  1401.  
  1402. /******************************************************************************
  1403.  * (send <listwidget> :GET_SELECTED_ITEMS)
  1404.  *     ==> returns an array of XmStrings.
  1405.  *
  1406.  * This retrieves the XmList widget resources XmNselectedItems and
  1407.  * XmNselectedItemCount from <listwidget> and returns an array of XmStrings
  1408.  * representing the selected items in the list widget.
  1409.  *******************************************************************************/
  1410. LVAL Xm_List_Widget_Class_Method_GET_SELECTED_ITEMS()
  1411. {
  1412.   LVAL self;
  1413.   Widget widget_id;
  1414.   XmStringTable xmstrtab;
  1415.   int        xmstrtab_size;
  1416.  
  1417.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  1418.   xllastarg();
  1419.  
  1420.   ARGLIST_RESET();
  1421.   ARGLIST_ADD(XmNselectedItems, &xmstrtab);
  1422.   ARGLIST_ADD(XmNselectedItemCount, &xmstrtab_size);
  1423.   XtGetValues(widget_id, ARGLIST());
  1424.  
  1425.   return (Wxms_XmStringTable_To_Lisp_Vector(xmstrtab, xmstrtab_size));
  1426. }
  1427.  
  1428.  
  1429. /******************************************************************************
  1430.  *
  1431.  ******************************************************************************/
  1432. Wc_List_Init()
  1433. {
  1434.   LVAL o_XM_LIST_WIDGET_CLASS;
  1435.   extern LVAL Wcls_Create_Subclass_Of_WIDGET_CLASS(); /* w_classes.c */
  1436.   extern      xladdmsg();    /* from xlobj.c */
  1437.  
  1438.   o_XM_LIST_WIDGET_CLASS =
  1439.     Wcls_Create_Subclass_Of_WIDGET_CLASS("XM_LIST_WIDGET_CLASS",
  1440.                      xmListWidgetClass);
  1441.  
  1442.   /* a special :isnew method on this class allows for the creation of this
  1443.      widget inside a scrolled window if the submessage keyword :scrolled 
  1444.      is given ... */
  1445.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ISNEW", 
  1446.        FTAB_Xm_List_Widget_Class_Method_ISNEW);
  1447.  
  1448. #ifdef WINTERP_MOTIF_11
  1449.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":PARENT", 
  1450.        FTAB_Xm_List_Widget_Class_Method_PARENT);
  1451. #endif                /* WINTERP_MOTIF_11 */
  1452.   
  1453.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ADD_ITEM", 
  1454.        FTAB_Xm_List_Widget_Class_Method_ADD_ITEM);
  1455.  
  1456. #ifdef WINTERP_MOTIF_11
  1457.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ADD_ITEMS", 
  1458.        FTAB_Xm_List_Widget_Class_Method_ADD_ITEMS);
  1459. #endif                /* WINTERP_MOTIF_11 */
  1460.  
  1461.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ADD_ITEM_UNSELECTED", 
  1462.        FTAB_Xm_List_Widget_Class_Method_ADD_ITEM_UNSELECTED);
  1463.  
  1464.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DELETE_ITEM", 
  1465.        FTAB_Xm_List_Widget_Class_Method_DELETE_ITEM);
  1466.  
  1467. #ifdef WINTERP_MOTIF_11
  1468.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DELETE_ITEMS", 
  1469.        FTAB_Xm_List_Widget_Class_Method_DELETE_ITEMS);
  1470. #endif                /* WINTERP_MOTIF_11 */
  1471.  
  1472.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DELETE_POS", 
  1473.        FTAB_Xm_List_Widget_Class_Method_DELETE_POS);
  1474.  
  1475. #ifdef WINTERP_MOTIF_11
  1476.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DELETE_ITEMS_POS", 
  1477.        FTAB_Xm_List_Widget_Class_Method_DELETE_ITEMS_POS);
  1478.  
  1479.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DELETE_ALL_ITEMS", 
  1480.        FTAB_Xm_List_Widget_Class_Method_DELETE_ALL_ITEMS);
  1481.  
  1482.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":REPLACE_ITEMS", 
  1483.        FTAB_Xm_List_Widget_Class_Method_REPLACE_ITEMS);
  1484.  
  1485.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":REPLACE_ITEMS_POS", 
  1486.        FTAB_Xm_List_Widget_Class_Method_REPLACE_ITEMS_POS);
  1487. #endif                /* WINTERP_MOTIF_11 */
  1488.  
  1489.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SELECT_ITEM", 
  1490.        FTAB_Xm_List_Widget_Class_Method_SELECT_ITEM);
  1491.  
  1492.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SELECT_POS", 
  1493.        FTAB_Xm_List_Widget_Class_Method_SELECT_POS);
  1494.  
  1495.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DESELECT_ITEM", 
  1496.        FTAB_Xm_List_Widget_Class_Method_DESELECT_ITEM);
  1497.  
  1498.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DESELECT_POS", 
  1499.        FTAB_Xm_List_Widget_Class_Method_DESELECT_POS);
  1500.  
  1501.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":DESELECT_ALL_ITEMS", 
  1502.        FTAB_Xm_List_Widget_Class_Method_DESELECT_ALL_ITEMS);
  1503.  
  1504.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_POS", 
  1505.        FTAB_Xm_List_Widget_Class_Method_SET_POS);
  1506.  
  1507.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_BOTTOM_POS", 
  1508.        FTAB_Xm_List_Widget_Class_Method_SET_BOTTOM_POS);
  1509.  
  1510.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_ITEM", 
  1511.        FTAB_Xm_List_Widget_Class_Method_SET_ITEM);
  1512.  
  1513.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_BOTTOM_ITEM", 
  1514.        FTAB_Xm_List_Widget_Class_Method_SET_BOTTOM_ITEM);
  1515.  
  1516. #ifdef WINTERP_MOTIF_11
  1517.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_ADD_MODE", 
  1518.        FTAB_Xm_List_Widget_Class_Method_SET_ADD_MODE);
  1519. #endif                /* WINTERP_MOTIF_11 */
  1520.  
  1521.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ITEM_EXISTS", 
  1522.        FTAB_Xm_List_Widget_Class_Method_ITEM_EXISTS);
  1523.  
  1524. #ifdef WINTERP_MOTIF_11
  1525.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ITEM_POS", 
  1526.        FTAB_Xm_List_Widget_Class_Method_ITEM_POS);
  1527.  
  1528.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":GET_MATCH_POS", 
  1529.        FTAB_Xm_List_Widget_Class_Method_GET_MATCH_POS);
  1530.  
  1531.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":GET_SELECTED_POS", 
  1532.        FTAB_Xm_List_Widget_Class_Method_GET_SELECTED_POS);
  1533. #endif                /* WINTERP_MOTIF_11 */
  1534.  
  1535.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_HORIZ_POS", 
  1536.        FTAB_Xm_List_Widget_Class_Method_SET_HORIZ_POS);
  1537.  
  1538.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":ADD_CALLBACK", 
  1539.        FTAB_Xm_List_Widget_Class_Method_ADD_CALLBACK);
  1540.  
  1541.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":SET_CALLBACK", 
  1542.        FTAB_Xm_List_Widget_Class_Method_SET_CALLBACK);
  1543.  
  1544.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":GET_ITEMS", 
  1545.        FTAB_Xm_List_Widget_Class_Method_GET_ITEMS);
  1546.  
  1547.   xladdmsg(o_XM_LIST_WIDGET_CLASS, ":GET_SELECTED_ITEMS", 
  1548.        FTAB_Xm_List_Widget_Class_Method_GET_SELECTED_ITEMS);
  1549.  
  1550.   
  1551.   s_INITIAL                          = xlenter("INITIAL");
  1552.   s_ADDITION                         = xlenter("ADDITION");
  1553.   s_MODIFICATION                     = xlenter("MODIFICATION");
  1554.   s_CALLBACK_ITEM                    = xlenter("CALLBACK_ITEM");
  1555.   s_CALLBACK_ITEM_LENGTH             = xlenter("CALLBACK_ITEM_LENGTH");
  1556.   s_CALLBACK_ITEM_POSITION           = xlenter("CALLBACK_ITEM_POSITION");
  1557.   s_CALLBACK_SELECTED_ITEMS          = xlenter("CALLBACK_SELECTED_ITEMS");
  1558.   s_CALLBACK_SELECTED_ITEM_COUNT     = xlenter("CALLBACK_SELECTED_ITEM_COUNT");
  1559.   s_CALLBACK_SELECTION_TYPE          = xlenter("CALLBACK_SELECTION_TYPE");
  1560. #ifdef WINTERP_MOTIF_11
  1561.   s_CALLBACK_SELECTED_ITEM_POSITIONS = xlenter("CALLBACK_SELECTED_ITEM_POSITIONS");
  1562. #endif                /* WINTERP_MOTIF_11 */
  1563. }
  1564.